Repository navigation
[Bugfix #1853] porch: save failed check output to a log, print its last lines - #1964
Open
waleedkadous wants to merge 12 commits into
Open
waleedkadous wants to merge 12 commits into
waleedkadous wants to merge 12 commits into
Conversation
… lines A failed check printed the first five lines of its stderr and nothing else. For the tests check those lines are npm config warnings, so the failing test was never named, and nothing was kept: a passing retry erased the evidence. - runCheck keeps stdout and stderr as one transcript, in the order porch read them, on every failure path: exit code, timeout, spawn error. `error` now says only why the check failed (exit code, signal, timeout). - porch check/done/approve save a failed shell check's full output to codev/projects/<id>-<name>/checks/<timestamp>-<phase>-<check>.log, keep the newest 20, and ignore the directory from inside (adopters' .gitignore has no rule for codev/projects/). A log that cannot be written is reported, not thrown, so the failure itself is still printed. - formatCheckResults prints the reason, the last 30 lines of the transcript, and the log path. - porch skill (all four copies) says where the log is.
…ed in full A check that prints 50 warnings before its failure shows the failure, the summary and the log path; the log holds all of stdout and stderr; a passing check writes nothing; a timed-out check and a porch.checks override are saved too; only the newest 20 logs are kept and git does not see them; an unwritable log is reported while the failure is still printed. Six of the seven fail against the old checks.ts. checks.test.ts follows `error` (now the reason, with stderr in the transcript) and the tail-first truncation.
…st written From CMAP (claude, non-blocking): - Chunks from the stdout and stderr pipes are not line-aligned, so a stdout chunk could land mid-line in a stderr one. Each stream now enters the transcript a whole line at a time; an unterminated last line is added at the end. - The stderr accumulator was written and never read once `error` became the reason. Dropped. - The newest-20 prune counted the file just written, so with 20 later-named logs present (clock skew, a copied log) porch printed a path it had just deleted. The new file is now excluded from pruning.
…urvives pruning Both fail against the previous checks.ts.
waleedkadous
marked this pull request as ready for review
November 24, 2026 01:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1853
Problem
When a porch check failed,
porch done(andporch check/porch approve) printed the first five lines of the check's stderr and nothing else. For the tests check those five lines are npm'sUnknown env configwarnings, so the failing test was never named. Nothing was written to disk, so a retry that passed erased the evidence.Reproduced through porch's own runner with one failing vitest test under the real
npm test -- --exclude='**/e2e/**' <file>command: porch printed fivenpm warnlines and.... The test's name was in stderr'sFAIL <file> > <suite> > <test>block, the last ~18 lines, and in stdout's× <test>line, which porch never printed.Root cause
packages/codev/src/commands/porch/checks.ts:runCheckput stdout inoutputand stderr inerror.formatCheckResultsprinted onlyerror.split('\n').slice(0, 5)and neveroutput.Fix
Scope follows the architect's comment on the issue: persist and tail. The commit-adjacent timing is out of scope; it is explained by #1956.
runCheckkeeps stdout and stderr as one transcript, in the order porch read them, on every failure path: non-zero exit, timeout, spawn error. Each stream enters it a whole line at a time, so the two pipes never splice mid-line.errornow holds only the reason (Exit code 1,Killed by SIGKILL,Timed out after …).runPhaseCheckssaves each failed shell check's full output tocodev/projects/<id>-<name>/checks/<timestamp>-<phase>-<check>.log. The file has a header (check, phase, command, cwd, result, duration) and then the transcript.porch check,porch doneandporch approveall pass the target.porch.checksoverrides and timeouts go through the same path..gitignore(*). Adopters'.gitignorehas no rule forcodev/projects/(see the note inconsult/tree-tripwire.ts), so a repo-level rule here would not have covered them. Porch only evergit addsstatus.yaml, andafx cleanup --keep-ignoredkeepscodev/projects/**by default.Full output: <path>. If the log cannot be written, porch printsFull output could not be saved: <why>and does not throw, so the failure is still shown.Testing
bugfix-1853-check-output.test.tshas 9 tests. Eight of them fail against the oldchecks.ts; the ninth, "a passing check writes nothing", is a guard.porch.checksoverride that fails is saved.git statusin a fresh repo shows none of them.checks.test.ts: two tests updated for the newerrormeaning and the tail-first truncation.VITEST_MAX_WORKERS=3 node packages/codev/bin/porch.js done bugfix-1853, using this branch's porch: build passed (19.5s), tests passed (142.6s), 165s wall, peak 1-min load 15. An earlier run with the installed porch failed onskill-refresh.test.ts, because I had edited the porch skill without regenerating its hash; that is fixed in b06deb4. That run showed the bug itself: the old porch printed fivenpm warnlines and saved nothing. The failure was named from vitest's results cache. A probe through porch's ownrunCheckconfirmed the cap reaches vitest: withVITEST_MAX_WORKERS=3, at most 3 workers; without it, 6.tsc --noEmit, a type-check of the edited tests, andpnpm build.porch checkandporch doneprint the failure line, the summary and the log path, andporch doneexits 1. Thechecks/directory holds the logs and its.gitignore, andgit statusis clean.npm test: the tail shows× the named failing test, theFAIL … > the named failing testblock, the summary and the log path.suites=true):CMAP
stderraccumulator, and the prune that could delete the new log (5a67e58, with tests in 32fd783).afx cleanup); seven positional arguments onrunPhaseChecks(a refactor, outside a bugfix); no size cap on a log (the in-memory copy is as before; the log count is bounded).chore(porch): …commits lack the[Bugfix #1853]prefix. Not changed. Those are porch's own state commits fromwriteStateAndCommit, which every porch project carries (87 of main's last 200 commits). Renaming them would mean rewriting and force-pushing porch-owned history. codex found no code, test or security issue.